package com.yyl.fmall.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @BelongsProject: rbacs
 * @BelongsPackage: com.yyl.rbacs.config
 * @Author: YuanSir
 * @CreateTime: 2022-10-28  09:40
 * @Description:
 * @Version: 1.0
 */


@Configuration
public class SwaggerConfig {
    
    @Bean
    public Docket buildDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(buildApiInfo())
                .select()
                // 要扫描的API(Controller)基础包
                .apis(RequestHandlerSelectors.basePackage("com.yyl.fmall"))
                .paths(PathSelectors.any())
                .build();
    }
    
    private ApiInfo buildApiInfo() {
        Contact contact = new Contact("YuanSir","https://gitee.com/yuan-yingluo/rbacs.git","965427902@qq.com");
        return new ApiInfoBuilder()
                .title("锋迷商城のAPI文档")
                .description("锋迷商城-api")
                .contact(contact)
                .version("1.0.0").build();
    }
    
}
